package demo15;

public class EnumDemo {

    public enum Day {
        MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY, SUNDAY
    }

    public static void main(String[] args) {
        // 使用枚举类型
        Day today = Day.WEDNESDAY;

        // 打印当前日期
        System.out.println("Today is: " + today);

        // 使用switch语句处理枚举
        switch (today) {
            case MONDAY:
                System.out.println("It's the start of the work week.");
                break;
            case FRIDAY:
                System.out.println("It's almost the weekend!");
                break;
            case SATURDAY:
            case SUNDAY:
                System.out.println("It's the weekend!");
                break;
            default:
                System.out.println("It's a regular workday.");
                break;
        }

        // 遍历枚举常量
        System.out.println("All days of the week:");
        for (Day day : Day.values()) {
            System.out.println(day);
        }
    }
}
